import os

from celery import Celery

# 为'celery'程序设置默认的Django设置模块。
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'luffy.settings.dev')


app = Celery('luffy_celery',
             broker='redis://127.0.0.1:6379/1',
             backend='redis://127.0.0.1:6379/2',
             include=['luffy_celery.tasks'])


# 禁用utc，使用北京时间
app.conf.timezone = 'Asia/Shanghai'
app.conf.enable_utc = False

app.conf.beat_schedule = {
    'add-every-30-seconds': {    # 定时配置的名称
        'task': 'luffy_celery.tasks.update_banner',     # 任务
        'schedule': 60*60*24*30,        # 设置执行间隔
    },
}




